//
//  HZStockInfoView.m
//  Stock_Stategy
//
//  Created by MayerF on 2017/10/23.
//  Copyright © 2017年 MayerF. All rights reserved.
//

#import "HZStockInfoView.h"
#import "HZWebView.h"

@interface HZStockInfoView()
@property (nonatomic, strong)HZWebView  *pWebView;
@end

@implementation HZStockInfoView

#pragma mark -
#pragma mark 生命周期
- (instancetype)init{
    self = [super init];
    if (self) {
        [self p_commonInit];
        self.backgroundColor = kMYHexToRGB(0xe8e8e8, 1);
    }
    return self;
}
- (void)p_commonInit
{
    _pWebView = [HZWebView new];
    
    
    [self p_initConstraints];
}

-(void)p_initConstraints{
    [self addSubview:_pWebView];
    [_pWebView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self);
        make.left.mas_equalTo(self);
        make.right.mas_equalTo(self);
        make.bottom.mas_equalTo(self);
    }];
}

- (void)loadStockInfoWithCode:(NSString *)code
{
    NSString *urlStr = [NSString stringWithFormat:@"%@%@",kAPIStockInfoUrl,code];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]];
    [_pWebView loadRequest:request];
}

@end
